#ifndef __REAL_TIME_DATA_ITEM_H__
#define __REAL_TIME_DATA_ITEM_H__

#include <string>
#include <stdint.h>
#include "lib.h"
#include "RealTimeDataInfo.h"
// 空的q值
#define NULL_Q_VALUE 0x80000000

// read time data item
class RealTimeDataItem
{
public:
  std::string id;
  int v = 0;
  int p = 0;
  int q = NULL_Q_VALUE;

  RealTimeDataInfo msg;

  RealTimeDataItem() {}
  RealTimeDataItem(std::string _id, RealTimeDataInfo m){id = _id; msg = m;}
  _CLASSS_JSON_FUNC(
    //对q值特殊处理，如果没有设该值，就不上报
    [&]()
    {
      if (q != NULL_Q_VALUE){__SIMPLE_SERIALIZE(q);} //有设置就上报
    }, 
    [&]()
    { 
      q = NULL_Q_VALUE;  //默认是没有这个值的
      //__SIMPLE_DESERIALIZE(q); 
    }, id, v, p);
};


#endif
